package gwtmodule1.client.gui.salesdept;

import gwtmodule1.client.gui.utils.DekoTable;
import gwtmodule1.client.gui.utils.FrameClient;
import gwtmodule1.client.gui.utils.HSpacer;
import gwtmodule1.client.gui.utils.Title;

import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;

public class PageInventoryReport extends VerticalPanel implements FrameClient {

	private class StockReportTable extends DekoTable {

		public StockReportTable() {
			super();
			addTitle("Brand");
			addTitle("Product");
			addTitle("Opening");
			addTitle("Sold");
			addTitle("Returned");
			addTitle("Closing");
		}

		public void addItem(String brand, String product, int opening,
				int closing, int returned) {
			AddRow r = addRow();
			r.add(brand);
			r.add(product);
			r.add(opening);
			r.add(opening - closing + returned);
			r.add(returned);
			r.add(closing);
		}

	}

	public PageInventoryReport() {
		super();
		add(new Title("Inventory Report"));
		add(createDateSel());
		add(new HSpacer());
		add(createReportTable());
	}

	private Widget createDateSel() {
		HorizontalPanel panel = new HorizontalPanel();
		panel.add(new HTML("Select Day:"));
		panel.add(new TextBox());
		return panel;
	}

	private Widget createReportTable() {
		StockReportTable table = new StockReportTable();
		table.addItem("Microsoft", "XBox", 342, 120, 0);
		table.addItem("Sony", "Playstation", 120, 119, 1);
		table.addItem("Nintendo", "Wii", 120, 0, 2);
		table.addItem("Apple", "iPhone", 1000, 2, 0);
		return table;
	}

	public void onShow(Object param) {
	}

}
